/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package domen;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Danilo
 */
@Entity
@Table(name = "downloadinfo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Downloadinfo.findAll", query = "SELECT d FROM Downloadinfo d"),
    @NamedQuery(name = "Downloadinfo.findByImei", query = "SELECT d FROM Downloadinfo d WHERE d.imei = :imei"),
    @NamedQuery(name = "Downloadinfo.findByDownloadDate", query = "SELECT d FROM Downloadinfo d WHERE d.downloadDate = :downloadDate")})
public class Downloadinfo implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "IMEI")
    private String imei;
    @Basic(optional = false)
    @NotNull
    @Column(name = "downloadDate")
    @Temporal(TemporalType.DATE)
    private Date downloadDate;
    @JoinColumn(name = "applications", referencedColumnName = "applicationId")
    @ManyToOne(optional = false)
    private Application applications;

    public Downloadinfo() {
    }

    public Downloadinfo(String imei) {
        this.imei = imei;
    }

    public Downloadinfo(String imei, Date downloadDate) {
        this.imei = imei;
        this.downloadDate = downloadDate;
    }

    public String getImei() {
        return imei;
    }

    public void setImei(String imei) {
        this.imei = imei;
    }

    public Date getDownloadDate() {
        return downloadDate;
    }

    public void setDownloadDate(Date downloadDate) {
        this.downloadDate = downloadDate;
    }

    public Application getApplications() {
        return applications;
    }

    public void setApplications(Application applications) {
        this.applications = applications;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (imei != null ? imei.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Downloadinfo)) {
            return false;
        }
        Downloadinfo other = (Downloadinfo) object;
        if ((this.imei == null && other.imei != null) || (this.imei != null && !this.imei.equals(other.imei))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "domen.Downloadinfo[ imei=" + imei + " ]";
    }
    
}
